<template>
  <div class="subject">
    <div v-for="(val, index) in arr" :key="index">
      <span>{{ val.num1 }}</span>
      <span>+</span>
      <span>{{ val.num2 }}</span>
      <span>=</span>
      <input type="number" v-model.number.lazy="val.sumUp" />
      <button @click="add(index)" :disabled="val.click == true">提交</button>
    </div>
  </div>
</template>

<script>
export default {
  props: ["arr"],
  methods: {
    add(val) {
      this.$emit("sum", val);
    },
  },
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>